package com.juc.threadPoolExecutor.threadPoolExecutor8;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Test1 {

	public static void main(String[] args) throws InterruptedException {
		MyRunnable1 myRunnable = new MyRunnable1();
		ThreadPoolExecutor pool = new ThreadPoolExecutor(2, 99999, 9999L, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>());
		pool.execute(myRunnable);
		System.out.println("main begin !  " + System.currentTimeMillis());
	    System.out.println(pool.awaitTermination(10, TimeUnit.SECONDS));
		System.out.println("main   end !  " + System.currentTimeMillis());
        //此实验证明awaitTermination()方法有阻塞性
		//打印false 是因为未对线程池执行shutdown()
	}
}
